using Circus.CodeEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace Circus.Syntax.CodeCompletion
{
	public class CodeCompletionProvider : List<IComparable>, ICodeCompletionProvider, IList<IComparable>, ICollection<IComparable>
	{
		private int selIndex = -1;
		private ImageList images;
		private bool useIndent = true;
		private bool useHtmlFormatting;
		private bool showDescriptions;
		private string editField = string.Empty;
		private bool focusMode = false;
        public event ClosePopupEvent ClosePopup;
        public event ShowPopupEvent ShowPopup;
		public virtual int ColumnCount
		{
			get
			{
				return 0;
			}
		}
		public virtual string[] Strings
		{
			get
			{
				string[] array = new string[base.Count];
				for (int i = 0; i < base.Count; i++)
				{
					array[i] = this.GetText(i);
				}
				return array;
			}
		}
		public virtual int[] ImageIndexes
		{
			get
			{
				int[] array = new int[base.Count];
				for (int i = 0; i < base.Count; i++)
				{
					array[i] = this.GetImageIndex(i);
				}
				return array;
			}
		}
		public virtual string[] Descriptions
		{
			get
			{
				string[] array = new string[base.Count];
				for (int i = 0; i < base.Count; i++)
				{
					array[i] = this.GetDescription(i);
				}
				return array;
			}
		}
		public virtual bool ShowDescriptions
		{
			get
			{
				return this.showDescriptions;
			}
			set
			{
				if (this.showDescriptions != value)
				{
					this.showDescriptions = value;
					this.OnShowDescriptionsChanged();
				}
			}
		}
		public virtual int SelIndex
		{
			get
			{
				return this.selIndex;
			}
			set
			{
				if (this.selIndex != value)
				{
					this.selIndex = value;
					this.OnSelIndexChanged();
				}
			}
		}
		public virtual ImageList Images
		{
			get
			{
				return this.images;
			}
			set
			{
				if (this.images != value)
				{
					this.images = value;
					this.OnImagesChanged();
				}
			}
		}
		public virtual bool UseIndent
		{
			get
			{
				return this.useIndent;
			}
			set
			{
				if (this.useIndent != value)
				{
					this.useIndent = value;
					this.OnUseIndentChanged();
				}
			}
		}
		public virtual bool UseHtmlFormatting
		{
			get
			{
				return this.useHtmlFormatting;
			}
			set
			{
				if (this.useHtmlFormatting != value)
				{
					this.useHtmlFormatting = value;
					this.OnUseHtmlFormattingChanged();
				}
			}
		}
		public virtual bool FormatDisplayText
		{
			get
			{
				return false;
			}
		}
		public bool FocusMode
		{
			get
			{
				return this.focusMode;
			}
			set
			{
				if (this.focusMode != value)
				{
					this.focusMode = value;
				}
			}
		}
		public virtual string EditField
		{
			get
			{
				return this.editField;
			}
			set
			{
				if (this.editField != value)
				{
					this.editField = value;
					this.OnEditFieldChanged();
				}
			}
		}
		public virtual string EditPath
		{
			get
			{
				return string.Empty;
			}
		}
	
		protected virtual void OnShowDescriptionsChanged()
		{
		}
		protected virtual void OnSelIndexChanged()
		{
		}
		protected virtual void OnImagesChanged()
		{
		}
		protected virtual void OnUseIndentChanged()
		{
		}
		protected virtual void OnUseHtmlFormattingChanged()
		{
		}
		protected virtual void OnEditFieldChanged()
		{
		}
		public virtual bool ColumnVisible(int column)
		{
			return false;
		}
		public virtual bool ColumnSpace(int column)
		{
			return true;
		}
		public virtual string GetColumnText(int index, int column)
		{
			return string.Empty;
		}
		public virtual string GetText(int index)
		{
			return string.Empty;
		}
		public virtual string GetName(int index)
		{
			return string.Empty;
		}
		public virtual string GetDisplayText(int index)
		{
			return this.GetName(index);
		}
		public virtual int GetPriority(int index)
		{
			return 0;
		}
		public virtual int IndexOfName(string name, bool caseSensitive)
		{
			int result;
			for (int i = 0; i < base.Count; i++)
			{
				if (string.Compare(name, this.GetName(i), !caseSensitive) == 0)
				{
					result = i;
					return result;
				}
			}
			result = -1;
			return result;
		}
		public virtual ICodeCompletionProvider GetParent()
		{
			return null;
		}
		public virtual void OnClosePopup(object sender, ClosingEventArgs e)
		{
			if (this.ClosePopup != null)
			{
				this.ClosePopup(sender, e);
			}
		}
		public virtual void OnShowPopup(object sender, ShowingEventArgs e)
		{
			if (this.ShowPopup != null)
			{
				this.ShowPopup(sender, e);
			}
		}
		public virtual int GetImageIndex(int index)
		{
			return -1;
		}
		public virtual string GetDescription(int index)
		{
			return string.Empty;
		}
		void ICodeCompletionProvider.Sort()
		{
			base.Sort();
		}
		void ICodeCompletionProvider.Sort(IComparer<IComparable> comparer)
		{
			base.Sort(comparer);
		}
	}
}
